/*2创建武明波类*/
/*class Wumingbo{
    public String name;
    public int age;
    public int weight;

    public void eat(){
        System.out.println(name+"狗粮");
    }
}
public class Date {
    public static void main1(String[] args) {
        Wumingbo wumingbo=new Wumingbo();
        wumingbo.name="武明波小狗";
        wumingbo.age=21;
        wumingbo.weight=120;
        System.out.println(wumingbo.weight);
        System.out.println(wumingbo.age);
        System.out.println(wumingbo.name);

        Wumingbo wumingbo1=new Wumingbo();
        wumingbo.name="武明波是小猫";
        System.out.println(wumingbo.name);

    }
}*/
/*2创建小猫类*/
    /*class Cat{
   public String name;
    public int  age;
    public int weight;
    public String color;
    public void cry(){
        System.out.println(name+"喵喵喵");
    }

}
public class Date {
    public static void main2(String[] args) {
        Cat cat=new Cat();
        cat.name="小波";
        cat.color="黄色";
        cat.age=2;
        cat.weight=3;
        cat.cry();
        System.out.println(cat.name);
        System.out.println(cat.color);
        System.out.println(cat.age);
        System.out.println(cat.weight);
        cat.cry();
    }

}*/
/*3this引用*/
 /*public class Date{                                       //公共类Date
    public int year;                                    //成员变量/三个对象
    public int month;
    public int day;

    public void setDate(int year, int month, int day) {                                             //成员方法
      this.year = year;                                                                             //this引用
       this.month  = month;
        this.day= day;

    }
public void pritdate(){
        System.out.println(year +"年"+month+"月"+day+"天");
    }
    public static void main(String[] args) {
        Date date=new Date();                                                                       //局部变量date//创建对象
        date.setDate(2008,8,21);                                                    //调用方法setdown
        date.pritdate();                                                                            //调用方法pritdate打印

        Date date1=new Date();                                                                        //局部变量date1//创建对象
        date1.setDate(2019,9,9);                                                    //调用方法setdown
        date1.pritdate();
    }
}*/

/*3构造方法*/

public class j5 {
    public int year;
    public int month;
    public j5() {
        this.year=2028;
        this.month=8;
        System.out.println("无参构造方法");

    }
    public j5(int year, int month) {

        System.out.println("有参构造方法");
        this.year=year;
        this.month=month;
    }

    public void printdate(){
        System.out.println(this.year+"年"+this.month+"月");
    }

    public static void main(String[] args) {
        j5 date = new j5();
        date.printdate();
        j5 date1=new j5(2008,9);
        date1.printdate();
    }
}